<template>
  <div class="container">
    <el-row :gutter="20">
      <el-col :span="8">
        <div class="trees">
          <el-tree
            :data="organization.list"
            icon-class="el-icon-plus"
            highlight-current
            :default-expanded-keys="treeKeys"
            node-key="CLIENT_NO"
            @node-click="treeNodeContextmenu"
          >
          </el-tree>
        </div>
      </el-col>
      <el-col :span="8">
        <div class="edit_content">
          <el-form
            ref="addOrganizationForm"
            :rules="addOrganization.rules"
            :model="editOrganization.form"
            label-width="80px"
          >
            <el-form-item prop="name" label="机构名称">
              <el-input v-model="editOrganization.form.name"></el-input>
            </el-form-item>
            <el-form-item label="机构属性">
              <el-input
                disabled
                v-model="editOrganization.form.level"
              ></el-input>
            </el-form-item>
            <div class="add_btns">
              <el-button
                type="success"
                @click="getAreaTeam"
                v-if="this.editOrganization.form.level == '班组'"
                >展示区域</el-button
              >
              <el-button
                type="primary"
                @click="handleAdd"
                v-if="this.editOrganization.form.level == '清扫队'"
                >新增下属组织机构</el-button
              >
            </div>
          </el-form>
        </div>
      </el-col>
    </el-row>
    <!-- 弹出框 -->
    <el-dialog
      :title="addDialogTitle"
      :visible.sync="isVisibleEdit"
      width="50%"
      :modal="false"
    >
      <el-form ref="form" :model="form" label-width="100px" class="flex">
        <!-- <el-form-item label="父级组织机构名称：" class="wid50">
          <el-input
            v-model="form.GROUPNAME"
            placeholder="请输入机构名称"
          ></el-input>
        </el-form-item> -->
        <el-form-item label="机构名称：" class="wid50">
          <el-input
            v-model="form.GROUPNAME"
            placeholder="请输入机构名称"
          ></el-input>
        </el-form-item>
      </el-form>

      <span slot="footer" class="dialog-footer">
        <el-button @click="isVisibleEdit = false">取 消</el-button>
        <el-button type="primary" @click="handleSubmit()">确 定</el-button>
      </span>
    </el-dialog>

    <!-- 组织机构 展示区域 -->
    <el-dialog
      @open="dialogOpenMap"
      :before-close="dialogCloseMap"
      title="展示区域"
      :visible.sync="formMap.show"
      width="80%"
    >
      <div style="width: 100%; height: 500px">
        <div style="width: 50%; height: 100%; float: left" id="mapDialog"></div>
        <div style="width: 49%; height: 100%; float: left; margin-left: 1%">
          <div style="height: 8%">
            <el-button style="padding: 0; border: 0">
              <el-upload
                action="/上传文件的接口"
                :on-change="onChange"
                :auto-upload="false"
                :show-file-list="false"
                accept=".xls, .xlsx"
                class="upload"
              >
                <el-button size="mini" type="success">经纬度导入</el-button>
              </el-upload>
            </el-button>
            <el-button v-if="formMap.isEmptyGPS" size="mini" type="primary" @click="setDrawingPolygonManager()"
              >新增区域</el-button
            >
            <el-button size="mini" type="primary" @click="handleNewGPS()"
              >新增经纬度</el-button
            >
          </div>
          <el-table :data="formMap.data" height="92%">
            <el-table-column type="index" label="顺序"> </el-table-column>
            <el-table-column
              prop="lng"
              label="经度"
              align="center"
              :formatter="formatterLng"
            ></el-table-column>
            <el-table-column
              prop="lat"
              label="纬度"
              align="center"
              :formatter="formatterLat"
            ></el-table-column>
            <el-table-column label="操作">
              <template slot-scope="scope">
                <el-button
                  type="text"
                  @click="handleEditGPS(scope.$index, scope.row)"
                  >编辑</el-button
                >
                <el-button
                  type="text"
                  @click="handleDeleteGPS(scope.$index, scope.row)"
                  style="color: red"
                  >删除</el-button
                >
              </template>
            </el-table-column>
          </el-table>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="saveWorkerClientGPS"
          >保存经纬度</el-button
        >
        <el-button @click="dialogCloseMap">取 消</el-button>
      </span>
    </el-dialog>

    <!-- 经纬度 新增编辑 弹出框 -->
    <el-dialog
      :title="formGPS.title"
      :visible.sync="formGPS.isShow"
      width="50%"
      :modal="false"
    >
      <el-form ref="formGPS" :model="formGPS" label-width="100px" class="flex">
        <el-form-item label="经度：" class="wid50">
          <el-input v-model="formGPS.lng" placeholder="请输入经度"></el-input>
        </el-form-item>
        <el-form-item label="纬度：" class="wid50">
          <el-input v-model="formGPS.lat" placeholder="请输入纬度"></el-input>
        </el-form-item>
        <el-form-item label="顺序：" class="wid50">
          <el-input
            :disabled="formGPS.title === '编辑经纬度'"
            v-model="formGPS.index"
            placeholder="请输入经纬度的顺序位置"
          ></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="formGPS.isShow = false">取 消</el-button>
        <el-button type="primary" @click="handleSubmitGPS()">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import '@/assets/css/common.css'
import { formatDate } from '@/common/js/date.js'
import export2Excel from '@/utils/exportExcel/index.js'
export default {
  data () {
    return {
      formGPS: {
        title: '',
        isShow: false,
        index: 0,
        lng: '',
        lat: '',
      },
      addDialogTitle: '',
      treeKeys: [],
      mapDialog: null,
      formMap: {
isEmptyGPS: false,
        polygon: null,
        show: false,
        data: [],

      },
      isVisibleMapPlayback: false,
      organizationShow: false,
      organization: {
        show: false,
        list: []
      },
      // 添加班组
      addOrganization: {
        show: false,
        addRules: {
          name: [
            { required: true, message: '请输入机构名称', trigger: 'blur' }
          ]
        },
        form: {
          name: '',
          attribute: '',
          preName: '',
          ParentNo: 0
        }
      },
      // 编辑班组
      editOrganization: {
        show: false,
        form: {
          name: '',
          clientNo: '',
          PARENT_NO: ''
        }
      },
      addShow: true,
      editShow: true,
      selectBox: true,
      currentPage: 1, //初始页
      pageSize: 10,    //    每页的数据
      // 人员管理
      person: {
        name: '',
        client: '',
        clientList: []
      },
      // 新增人员
      newPersonForm: {
        show: false,
        Name: '',
        Phone: '',
        SimCardNo: '',
        BirhDay: '',
        WorkDate: '',
        Sex: '男',
        WorkType: '',
        ClientNo: ''
      },
      tableData: [],
      originalData: [],
      form: {},
      isVisibleEdit: false,
      mapDrawingPolygon: null,
    }
  },
  created () {
    // this.getTeamList();
    this.getOrganizationList();
  },
  methods: {
    // 获取组织机构列表
    async getOrganizationList () {
      this.organization.list = []
      const { data } = await this.$Http.get('/DataListCompany/GetClientCleanerListApiNew?ClientNo=' + localStorage.getItem('CLIENT_NO'))

      data.forEach(item => {
        const obj = {}
        obj.id = 1
        obj.label = item.CLIENT_NAME
        obj.CLIENT_NO = item.CLIENT_NO
        obj.PARENT_NO = item.PARENT_NO
        obj.children = item.cleaningTeams

        this.organization.list.push(obj)
      })

      this.organization.list = this.organization.list.filter(item => {
        item.children = item.children.filter(ele => {
          ele.label = ele.CLIENT_NAME
          ele.children = ele.teams
          delete ele.CLIENT_NAME
          delete ele.teams

          ele.children = ele.children.filter(e => {
            e.label = e.CLIENT_NAME
            delete e.CLIENT_NAME
            return e
          })
          return ele
        })
        return item
      })
    },

    // 新增班组
    handleAdd () {
      this.addDialogTitle = '新增班组信息'
      //清空编辑框
      this.form = {}
      //展示窗口
      this.isVisibleEdit = true;
    },

    // 点击保存，判断是新增还是编辑操作
    handleSubmit () {
      if (this.addDialogTitle == '新增班组信息') {
        this.saveAdd()
      } else {
        this.saveEdit()
      }
    },
    // 新增保存
    async saveAdd () {
      const { data } = await this.$Http.get('/Worker/SaveGroupInfoPB?GROUPNAME=' + this.form.GROUPNAME + '&PARENTNO=' + this.editOrganization.form.clientNo + '&TYPE=1')
      if (data.IsSucess) {
        this.$message.success('新增成功');
        this.isVisibleEdit = false
        this.getOrganizationList()
      } else {
        this.$message.error('新增失败');
      }
    },
    // 右键树形节点
    treeNodeContextmenu (event, dataObj, node, d) {

      // console.log(dataObj)
      var arrKeys = []
      var isSelect = false;
      this.treeKeys.forEach(element => {
        if (element === dataObj.data.CLIENT_NO) {
          isSelect = true
        } else {
          arrKeys.push(element)
        }
      });
      if (isSelect) {
        this.treeKeys = arrKeys;
      } else {
        this.treeKeys.push(dataObj.data.CLIENT_NO)
      }

      // // 获取整体弹窗位置
      // const organizationLocation = document.querySelector('.organization').getBoundingClientRect()

      // this.selectBox = true
      // // 设置选择框的位置
      // this.$refs.selectBox.style.left = event.clientX - organizationLocation.left + 'px'
      // this.$refs.selectBox.style.top = event.clientY - organizationLocation.top + 'px'

      // if (node.level === 2) {
      //   this.addOrganization.form.attribute = '班组'
      //   this.addOrganization.form.preName = dataObj.label
      //   this.addOrganization.form.ParentNo = dataObj.CLIENT_NO
      //   this.addShow = true
      //   this.editShow = false
      // }
      // if (node.level === 3) {
      //   this.editShow = true
      //   this.addShow = false
      this.editOrganization.form.name = dataObj.data.label
      this.editOrganization.form.clientNo = dataObj.data.CLIENT_NO
      this.editOrganization.form.PARENT_NO = dataObj.data.PARENT_NO
      this.editOrganization.form.level = '清扫队'
      if (dataObj.data.PARENT_NO.length > 7) {
        this.editOrganization.form.level = '班组'
      }
    },

    //区域展示
    dialogCloseMap () {
      this.mapDialog.clearOverlays()
      this.formMap.show = false
      this.formMap.data = [];
      this.formMap.polygon = null
    },
    dialogOpenMap () {
      setTimeout(() => {
        if (!this.mapDialog) {
          this.mapDialogShow()
        }
      }, 1000)
    },
    async mapDialogShow () {
      this.mapDialog = new BMap.Map('mapDialog')// 创建Map实例
      // 初始化地图,设置中心点坐标和地图级别
      this.mapDialog.centerAndZoom(
        new BMap.Point(
          localStorage.getItem("LNG"),
          localStorage.getItem("LAT")
        ),
        16
      );
      this.mapDialog.enableScrollWheelZoom(true)//开启鼠标滚轮缩放
    },

    async getAreaTeam () {
      this.formMap.show = true
      var url = 'Worker/GetWorkerClientnoSideFuzzy?ClientNo=' + this.editOrganization.form.clientNo
      let { data } = await this.$Http.get(url)
      if (data.length > 0) {
        this.formMap.isEmptyGPS = false
        //   var dataArr = []
        var points = []
        //   var districtName = data[0].NAME

        data.forEach(element => {
          //     if (element.NAME === districtName) {
          points.push(new BMap.Point(element.LONGITUDE, element.LATITUDE))
          //     } else {
          //       dataArr.push({ 'name': districtName, 'points': points })
          //       // this.drawDistrictPolygon(districtName, points)

          //       points = []
          //       points.push(new BMap.Point(element.LONGITUDE, element.LATITUDE))
          //       districtName = element.NAME
          //     }
        });
        //   dataArr.push({ 'name': districtName, 'points': points })
        // this.formMap.data = dataArr;
        //   // eventBus.$emit('drawAreaTeam', data)
        this.formMap.data = points

        //   // this.drawAreaTeam(data)
        setTimeout(() => {
          this.drawAreaTeam()
        }, 2000)

      } else {
        this.formMap.isEmptyGPS = true
        this.formMap.data = []
        this.formMap.polygon = null
        //   this.formMap.show = true
        //   // this.$message({
        //   //   message: '未查找到' + this.editOrganization.form.name + '工作区域',
        //   //   type: 'warning'
        // })
      }


    },
    drawAreaTeam () {
      // var points = []
      // // console.log(this.formMap.data)
      // this.formMap.data.forEach(element => {
      //   points.push(new BMap.Point(element.LONGITUDE, element.LATITUDE))
      // });

      if (!this.formMap.polygon) {
        var polygon = new BMap.Polygon(this.formMap.data, {
          strokeColor: "#2E8B57",
          fillColor: "#F0FFF0",
        });
        this.formMap.polygon = polygon;
        this.mapDialog.addOverlay(polygon);

        const _this = this
        polygon.addEventListener('click', function (e) {
          _this.editPolygon(this)
          // _this.formMap.data = this.getPath()
        })

        var opts = {
          position: polygon.getBounds().getCenter(), // 指定文本标注所在的地理位置
          offset: new BMap.Size(-50, 0), // 设置文本偏移量
        };
        // 创建文本标注对象
        var label = new BMap.Label(this.editOrganization.form.name, opts);
        // 自定义文本标注样式
        label.setStyle({
          color: "#2E8B57",
          borderRadius: "3px",
          borderColor: "#ccc",
          padding: "3px",
          fontSize: "15px",
          height: "20px",
          lineHeight: "20px",
          fontFamily: "微软雅黑",
        });
        this.mapDialog.addOverlay(label);
      } else {
        this.formMap.polygon.setPath(this.formMap.data)
      }

      // 区域位于地图显示范围中心
      this.mapDialog.setViewport(this.formMap.data);
    },
    editPolygon (overlay) {
      if (this.overlay) {
        this.overlay.disableEditing()
      }
      this.overlay = overlay
      const _this = this

      overlay.enableEditing() // 设置电子围栏可编辑
      // 覆盖物添加监听事件，监听覆盖物编辑情况
      overlay.addEventListener('lineupdate', function (r) {
        _this.formMap.data = this.getPath()
        console.log('编辑结束')
        console.log(_this.formMap.data)
      })
    },
    // 划分片区
    setDrawingPolygonManager () {
      // if (this.mapDrawingPolyLine) {
      //   // 结束画图
      //   this.closePolyLineManager()
      // }
      // 显示经纬度表
      // this.isShowTableForPoly = true
      // 电子围栏 初始化
      if (!this.mapDrawingPolygon) {
        // 实例化绘图工具
        this.mapDrawingPolygon = new BMapLib.DrawingManager(this.mapDialog, {
          // enableDrawingTool: true,//工具栏
          drawingToolOptions: {
            anchor: BMAP_ANCHOR_TOP_RIGHT,
            offset: new BMap.Size(5, 5)
          }
        })

        // 设置绘制模式为绘制多边形
        this.mapDrawingPolygon.setDrawingMode('polygon')

        const _this = this
        // 监听绘制结果
        this.mapDrawingPolygon.addEventListener('polygoncomplete', function (e, overlay) {
          // this.mapDrawingPolygon.addEventListener('overlaycomplete', res => {
          // console.log('aa')
          _this.formMap.polygon = overlay;
          _this.formMap.data = overlay.getPath()
          overlay.addEventListener('click', function (e) {
            // this.ID = null;
            // console.log('editPolygon11')
            // console.log('新建，后选中')
            _this.editPolygon(this)
            _this.formMap.data = this.getPath()
          })
          // _this.formMap.data = overlay.getPath()
          // console.log(this.formMap.data)
        })
      }
      // if (this.mapDrawingPolygon.isOpen) {
      //   // 结束画图
      //   this.mapDrawingPolygon.close()
      // } else {
      // 开始画图
      this.mapDrawingPolygon.open()
      // }
    },
    // 添加班组按钮
    addNewOrganization () {
      this.addOrganization.show = true
      this.addOrganization.form.name = ''
      this.editOrganization.show = false
      this.selectBox = false
    },
    // 编辑班组按钮
    editNewOrganization () {
      this.editOrganization.show = true
      this.addOrganization.show = false
      this.selectBox = false
    },
    // 编辑班组
    async editTeam () {
      if (this.editOrganization.form.name === '') {
        this.$message({
          showClose: true,
          message: '机构名称不能为空！！',
          type: 'warning'
        })
        return false
      }
      const params = {
        ClientNo: this.editOrganization.form.clientNo,
        ClientName: this.editOrganization.form.name,
        ParentNo: this.editOrganization.form.PARENT_NO,
        CreateTime: new Date().toLocaleDateString().split('/').join('-') + ' ' + new Date().toTimeString().split(' ')[0]
      }
      await this.$Http.get('/DataListCompany/UpdateTeamApi', { params })
      // 刷新树形结构
      this.getOrganizationList()
      this.editOrganization.show = false
    },
    // 删除班组
    async deleteOrganization () {
      await this.$Http.get(`/DataListCompany/DeleteTeamApi?ClientNo=${this.editOrganizationForm.clientNo}`)
      this.getOrganizationList()
      this.selectBox = false
    },
    // 添加组织机构
    async addTeam () {
      if (this.addOrganization.form.name === '') {
        this.$message({
          showClose: true,
          message: '机构名称不能为空！！',
          type: 'warning'
        })
        return false
      }
      const { data } = await this.$Http.get(`/DataListCompany/GetMaxNoApi?ClientNo=${this.addOrganization.form.ParentNo}`)
      // 新班组编号
      let newClientNo = ''
      const maxClientNo = Number(data[0].ClientNo.substr(9))
      newClientNo = maxClientNo + 1
      if (newClientNo < 10) newClientNo = '0' + newClientNo
      newClientNo = this.addOrganization.form.ParentNo + newClientNo
      // 参数
      const params = {
        ClientNo: newClientNo,
        ClientName: this.addOrganization.form.name,
        ParentNo: this.addOrganization.form.ParentNo,
        CreateTime: new Date().toLocaleDateString().split('/').join('-') + ' ' + new Date().toTimeString().split(' ')[0]
      }
      await this.$Http.get('/DataListCompany/AddTeamApi', { params })
      // 刷新树形结构
      this.getOrganizationList()
      this.addOrganization.show = false
    },
    async getTeamList () {
      const { data } = await this.$Http.get('DataListCompany/GetCleaneranceApi?ClientNo=' + localStorage.getItem('CLIENT_NO'))
      this.person.clientList = data
      this.person.clientList.unshift({ "CLIENT_NO": "0", "CLIENT_NAME": "全部" })
      // this.attendanceMonth.records.teamList = data
    },
    async getlistdata () {
      var url = 'DataListCompany/GetTeamWorkApi?ClientNo=' + localStorage.getItem('CLIENT_NO')
      const { data } = await this.$Http.get(url)
      this.originalData = data

      this.personQuery()
    },
    // 人员管理查询
    personQuery () {
      this.tableData = this.originalData
      const { name, client } = this.person
      if (name) this.tableData = this.tableData.filter(item => item.CLIENT_NAME.includes(name))
      if (client) this.tableData = this.tableData.filter(item => item.CLIENT_NO.includes(client))
    },
    // 新增人员
    addNewPerson () {
      this.editPersonShow = false
      this.person.listShow = false
      this.newPersonForm = {
        show: true,
        Name: '',
        Phone: '',
        SimCardNo: '',
        BirhDay: '',
        WorkDate: '',
        Sex: '男',
        WorkType: '',
        ClientNo: ''
      }
    },
    async addPerson (formName) {
      for (const k in this.newPersonForm) {
        if (this.newPersonForm[k] === '') {
          this.$message({
            message: '表单项不能为空！！',
            type: 'warning'
          })
          return false
        }
      }
      const { data } = await this.$Http.get('/DataListCompany/AddWorkerApi', {
        params: this.newPersonForm
      })
      if (data.IsSucess) {
        this.$message({
          message: '新增成功！！！',
          type: 'success'
        })
        this.getlistdata()
        this.resetForm('newPersonForm')
        this.newPersonForm.show = false
      }
    },
    // 重置新增人员表单
    resetForm (formName) {
      this.$refs[formName].resetFields()
      // this.newPersonForm.SimCardNo = ''
      // this.newPersonForm.BirhDay = ''
      // this.newPersonForm.WorkDate = ''
      this.newPersonForm = {
        show: true,
        Name: '',
        Phone: '',
        SimCardNo: '',
        BirhDay: '',
        WorkDate: '',
        Sex: '男',
        WorkType: '',
        ClientNo: ''
      }
    },
    async handleEdit (index, row) {

      //   this.idx = index;
      //   this.form = row;
      //   this.editVisible = true;
      const { data } = await this.$Http.get('/DataListCompany/DeleteWorkerApi?VID=' + row.VID)
      if (data.IsSucess) {
        this.$message({
          message: '删除成功！！！',
          type: 'success'
        })
        this.getlistdata()
      }
    },
    handleNewGPS () {
      this.formGPS.title = '新增经纬度'
      this.formGPS.isShow = true;
      this.formGPS.index = ''
      this.formGPS.lng = ''
      this.formGPS.lat = ''
    },
    handleEditGPS (index, row) {
      console.log(row)
      this.formGPS.title = '编辑经纬度'
      this.formGPS.isShow = true;
      this.formGPS.index = index + 1
      this.formGPS.lng = row.lng
      this.formGPS.lat = row.lat
    },
    handleDeleteGPS (index, rows) {
      this.formMap.data.splice(index, 1);
      this.formMap.polygon.setPath(this.formMap.data)
    },
    handleSubmitGPS () {
      // var item = this.formMap.data[0]
      // item.LONGITUDE = this.formGPS.lng
      // item.LATITUDE = this.formGPS.lat
      if (this.formGPS.title === '新增经纬度') {
        this.formMap.data.splice((this.formGPS.index - 1), 0, new BMap.Point(this.formGPS.lng, this.formGPS.lat));
        // this.formMap.data.splice((this.formGPS.index - 1), 0, { "lng": parseFloat(this.formGPS.lng), "lat": parseFloat(this.formGPS.lat) });
      } else {
        this.formMap.data[(this.formGPS.index - 1)].lng = parseFloat(this.formGPS.lng)
        this.formMap.data[(this.formGPS.index - 1)].lat = parseFloat(this.formGPS.lat)
      }
      console.log(this.formMap.data)
      this.formGPS.isShow = false;

      this.drawAreaTeam()
    },
    async saveWorkerClientGPS () {
      console.log(this.formMap.data)
      this.formMap.data[0].CLIENT_NO = this.editOrganization.form.clientNo
      this.formMap.data[0].CLIENT_NAME = this.editOrganization.form.name
      this.$axios({
        url: 'Worker/saveWorkerClientGPSTowgs84New',
        method: 'post',
        data: this.formMap.data
      }).then(res => {
        console.log(res)
        if (res.data.IsSucess) {
          this.$message.success('班组经纬度编辑成功')
          this.getAreaTeam();
          this.formMap.polygon.disableEditing()
        } else {
          this.$message.error('班组经纬度编辑失败' + '，' + res.data.Message);
        }
      })
    },
    // 导入Excel
    onChange (file, fileList) {
      //  console.log(fileList);
      this.fileData = file; // 保存当前选择文件
      this.readExcel(); // 调用读取数据的方法
    },
    // 读取数据
    readExcel (e) {
      let that = this;
      const files = that.fileData;
      console.log(files);
      if (!files) {
        //如果没有文件
        return false;
      } else if (!/\.(xls|xlsx)$/.test(files.name.toLowerCase())) {
        this.$message.error("上传格式不正确，请上传xls或者xlsx格式");
        return false;
      }
      const fileReader = new FileReader();
      console.log(fileReader)
      fileReader.onload = ev => {
        try {
          const data = ev.target.result;
          //  console.log(ev.target)
          //  console.log(this);
          const workbook = this.XLSX.read(data, {
            type: "binary"// 以字符编码的方式解析
          });

          if (workbook.SheetNames.length > 0) {
            const wsname = workbook.SheetNames[0];
            // workbook.SheetNames.forEach(element => {
            const ws = this.XLSX.utils.sheet_to_json(workbook.Sheets[wsname]); //生成json表格内容
            this.bulkLoad(ws)
            // });

          } else {
            this.$message.error("未读取到表格内容");
          }
        } catch (e) {
          console.log(e)
          return false;
        }
      };
      // 如果为原生 input 则应是 files[0]
      fileReader.readAsBinaryString(files.raw);
    },
    async bulkLoad (ws) {
      // console.log(ws)
      // this.formMap.data = ws
      // console.log(this.formMap.data)
      ws[0].CLIENT_NO = this.editOrganization.form.clientNo
      ws[0].CLIENT_NAME = this.editOrganization.form.name
      this.$axios({
        url: 'Worker/saveWorkerClientGPS',
        method: 'post',
        data: ws
      }).then(res => {
        console.log(res)
        if (res.data.IsSucess) {
          this.$message.success('班组经纬度保存成功')
          this.dialogCloseMap()
          this.getAreaTeam()
          // this.drawAreaTeam()
        } else {
          this.$message.error('班组经纬度保存失败' + '，' + res.data.Message);
        }
      })
    },
    formatterLng (row) {
      return row.lng.toFixed(parseFloat(6))
    },
    formatterLat (row) {
      return row.lat.toFixed(parseFloat(6))
    },
    // 分页导航
    handlePageChange (currentPage) {
      this.currentPage = currentPage;
      // console.log(this.currentPage)
      // this.$set(this.query, 'pageIndex', val);
      // this.getData();
    },
    handleSizeChange (size) {
      this.pageSize = size;
      console.log(this.pageSize)
    }
  }
}
</script>
<style scoped lang='less'>
.content {
  overflow-y: scroll;
}
.el-col-6 {
  min-width: 400px;
  min-height: 50px;
}
.el-table th {
  height: 40px;
}
.new_person {
  .el-form {
    width: 260px;
    // height: 180px;
    margin: 10px auto;
    background-color: #fff;
    .el-form-item {
      margin-bottom: 20px;
    }
    .btns {
      display: flex;
      align-items: center;
      justify-content: center;
      // padding-top: 10px;
      .el-button {
        margin: 0 10px;
        /deep/span {
          padding: 0 5px;
        }
      }
    }
  }
}
</style>